package itheima_245;

import java.util.TreeSet;

public class TreeSetDemo {
    public static void main(String[] args) {

        TreeSet<Student> t = new TreeSet<Student>();


        Student s1 = new Student(28,"张飞");
        Student s2 = new Student(54,"刘备");
        Student s3 = new Student(18,"马超");
        Student s4 = new Student(67,"关羽");

        t.add(s1);
        t.add(s2);
        t.add(s3);
        t.add(s4);

        for(Student a:t){
            System.out.println(a.getName()+a.getAge());
        }

    }
}
